package com.wwl.cms.utils.designModeTest.adapter.classadapter;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/6 16:37
 * @description:
 */
public class VoltageAdapter implements IVoltage5V {
    //获取到220V电压
    private Voltage220V voltage220V;//关联关系-聚合
    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }
    @Override
    public int output5V () {
        int dst = 0;
        if(null!=voltage220V){
            int src = voltage220V.output220v();
            System.out.println("使用对象适配器，进行适配");
            dst = src/44;
            System.out.println("适配完成，输出的电压为="+dst);
        }
        return dst;
    }
}
